#ifndef _DATA_TRANSFER_H
#define	_DATA_TRANSFER_H

#include "at32f4xx.h"
#define SendDataLength      50
extern u8 DataToSend[SendDataLength];

#define BYTE0(dwTemp)       ( *( (char *)(&dwTemp)		) )
#define BYTE1(dwTemp)       ( *( (char *)(&dwTemp) + 1) )
#define BYTE2(dwTemp)       ( *( (char *)(&dwTemp) + 2) )
#define BYTE3(dwTemp)       ( *( (char *)(&dwTemp) + 3) )

//================ϵͳ===================
#define HW_ALL		 0xFF
#define HW_TYPE			05
#define SWJ_ADDR 	 0xAF

#define HW_VER			1
#define SW_VER  		19
#define BL_VER			0
#define PT_VER			400

#define HEAD 0XAA
#define ADDR 0xFF

enum
{
	//
	PAR_NULL    = 0,
	PAR_HW_TYPE ,
	PAR_HW_VER,
	PAR_SW_VER,
	PAR_BL_VER,//  = 4,
	//
	PAR_INFO5,
	PAR_INFO6,
	PAR_INFO7,
	PAR_INFO8,
	PAR_INFO9,
	PAR_INFO10,
	//PID
	PAR_PID_1_P,//	=	11,
	PAR_PID_1_I,
	PAR_PID_1_D,
	PAR_PID_2_P,
	PAR_PID_2_I,
	PAR_PID_2_D,
	PAR_PID_3_P,
	PAR_PID_3_I,
	PAR_PID_3_D,
	PAR_PID_4_P,
	PAR_PID_4_I,
	PAR_PID_4_D,
	PAR_PID_5_P,
	PAR_PID_5_I,
	PAR_PID_5_D,
	PAR_PID_6_P,
	PAR_PID_6_I,
	PAR_PID_6_D,
	PAR_PID_7_P,
	PAR_PID_7_I,
	PAR_PID_7_D,
	PAR_PID_8_P,
	PAR_PID_8_I,
	PAR_PID_8_D,
	PAR_PID_9_P,
	PAR_PID_9_I,
	PAR_PID_9_D,
	PAR_PID_10_P,
	PAR_PID_10_I,
	PAR_PID_10_D,
	//
	PAR_PID_11_P,//  = 41,
	PAR_PID_11_I,
	PAR_PID_11_D,
	PAR_PID_12_P,
	PAR_PID_12_I,
	PAR_PID_12_D,
	PAR_PID_13_P,
	PAR_PID_13_I,
	PAR_PID_13_D,
	PAR_PID_14_P,
	PAR_PID_14_I,
	PAR_PID_14_D,
	PAR_PID_15_P,
	PAR_PID_15_I,
	PAR_PID_15_D,
	PAR_PID_16_P,
	PAR_PID_16_I,
	PAR_PID_16_D,
	PAR_PID_17_P,
	PAR_PID_17_I,
	PAR_PID_17_D,
	PAR_PID_18_P,
	PAR_PID_18_I,
	PAR_PID_18_D,
	//
	PAR_PID_ONE_1,
	PAR_PID_ONE_2,
	PAR_PID_ONE_3,
	PAR_PID_MODE,
	//FC_SET
	PAR_RCINMODE     =	71,
	PAR_UNLOCKPWM,
	PAR_UNLOCK_OO,
	PAR_AUTO_GYR_CAL,
	PAR_BAT_CELLS,
	PAR_LV_WARN_100,
	PAR_LV_RETN_100,
	PAR_LV_LAND_100,
	PAR_CENPOS_X,
	PAR_CENPOS_Y,
	PAR_CENPOS_Z,
	PAR_TAKEOFFHIGH	 ,
	PAR_TAKEOFFSPEED ,
	PAR_LANDSPEED,
	PAR_LANDSPEED_MAX,
	PAR_AUTO_LANDING,
	PAR_HEATSWITCH	 ,	
	PAR_HEAT_TMPER   ,	
	//
	PAR_MAX_SPEED_HOR,
	PAR_MAX_SPEED_PRC,
	PAR_MAX_SPEED_UP,
	PAR_MAX_SPEED_DW,
//	PAR_MAX_SPEED_YAW,
	//
	PAR_SAFE_ATT = 94,
	PAR_MAGMODE,
	PAR_ACANGVELMAX,
	PAR_YCANGVELMAX,
	PAR_YCANGACCMAX,
	PAR_RH_ALT,
	PAR_RH_VEL,
	//LX_IMU
	PAR_GYR_FILTER = 151,
	PAR_ACC_FILTER,
	PAR_ATT_FUSION,
	PAR_MAG_FUSION,
	PAR_HOR_FUSION,
	PAR_VER_FUSION,
	PAR_FENCE_MODE,
	PAR_FENCE_RADIUS,
	PAR_FENCE_WIDTH_X,
	PAR_FENCE_WIDTH_Y,
	PAR_FENCE_HEIGHT,
	PAR_COM1_BAUD,
	PAR_COM2_BAUD,
	PAR_COM2_MODE,
	PAR_RGBOUT_ENA,
	//
	PAR_DataOutTime_01=300,
	PAR_DataOutTime_02,
	PAR_DataOutTime_03,
	PAR_DataOutTime_04,
	PAR_DataOutTime_05,
	PAR_DataOutTime_06,
	PAR_DataOutTime_07,
	PAR_DataOutTime_08,
	PAR_DataOutTime_09,
	PAR_DataOutTime_0A,
	PAR_DataOutTime_0B,
	PAR_DataOutTime_0C,
	PAR_DataOutTime_0D,
	PAR_DataOutTime_0E,
	PAR_DataOutTime_20,
	PAR_DataOutTime_21,
	PAR_DataOutTime_30,
	PAR_DataOutTime_32,
	PAR_DataOutTime_33,
	PAR_DataOutTime_34,
	PAR_DataOutTime_40,
	PAR_DataOutTime_41,
	//
	PAR_DATA_NUM,
	//
	CAL_ACC_OFFSET_X = 1000,
	CAL_ACC_OFFSET_Y,
	CAL_ACC_OFFSET_Z,
	CAL_ACC_SENSIV_X,
	CAL_ACC_SENSIV_Y,
	CAL_ACC_SENSIV_Z,
	CAL_ACC_IEM_00,
	CAL_ACC_IEM_01,
	CAL_ACC_IEM_02,
	CAL_ACC_IEM_10,
	CAL_ACC_IEM_11,
	CAL_ACC_IEM_12,
	CAL_ACC_IEM_20,
	CAL_ACC_IEM_21,
	CAL_ACC_IEM_22,
	CAL_MAG_OFFSET_X,
	CAL_MAG_OFFSET_Y,
	CAL_MAG_OFFSET_Z,
	CAL_MAG_SENSIV_X,
	CAL_MAG_SENSIV_Y,
	CAL_MAG_SENSIV_Z,
};
void ANO_DT_Send_Sennor(s16 ACC_X,s16 ACC_Y,s16 ACC_Z,s16 GYR_X,s16 GYR_Y,s16 GYR_Z,u8 SHOCK_STA);
void ANO_DT_Send_Mag(s16 MAG_X,s16 MAG_Y,s16 MAG_Z,s16 ALT_BAR,s16 TMP,u8 BAR_STA,u8 MAG_STA);
void ANO_DT_Send_Posture(float rol,float PIT,float YAW,u8 FUSION_STA);
void ANO_DT_Send_Quaternions(float V0,float V1,float V2,float V3,u8 FUSION_STA);
void ANO_DT_Send_Height(s32 ALT_FU,s32 ALT_ADD,u8 ALT_STA);
void ANO_DT_Send_Operation(u8 MODE,u8 LOCKED, u8 CID,u8 CMD0,u8 CMD1);
void ANO_DT_Send_Speed(s16 SPEED_X,s16 SPEED_Y,s16 SPEED_Z);
void ANO_DT_Send_Excursion(s32 POS_X, s32 POS_Y);
void ANO_DT_Send_WindEstimation(s16 WIND_X,s16 WIND_Y);
void ANO_DT_Send_TargetPosition(s16 TAR_ROL,s16 TAR_PIT,s16 TAR_YAW);
void ANO_DT_Send_TargetSpend(s16 TAR_SPEED_X,s16 TAR_SPEED_Y,s16 TAR_SPEED_Z);
void ANO_DT_Send_Homeward(float R_A,s16 R_D);
void ANO_DT_Send_Power(float VOTAGE,float CURRENT);
void ANO_DT_Send_Connect(u8 STA_OF,u8 STA_GPS,u8 STA_MV,u8 STA_UWB,u8 STA_ALTADD);
void ANO_DT_Send_RGB(u8 BRI_R,u8 BRI_G,u8 BRI_B,u8 BRI_A);
void ANO_DT_Send_Logo(u8 COLOR,u8* str);
void ANO_DT_SendNumber(u8 color,s32 value,u8* str);
void ANO_DT_Send_PWM(u16 PWM1,u16 PWM2,u16 PWM3,u16 PWM4,u16 PWM5,u16 PWM6,u16 PWM7,u16 PWM8);
void ANO_DT_Send_Control(s16 CTRL_ROL,s16 CTRL_PIT,s16 CTRL_THR,s16 CTRL_YAW);
void ANO_DT_Send_GPS(u8 FIX_STA,u8 S_NUM,s32 LNG,s32 LAT,s32 ALT_GPS,s16 N_SPE,s16 E_SPE,s16 D_SPE,u8 PDOP,u8 SACC,u8 VACC);
void ANO_DT_Send_NOSINS(s32 POS_X,s32 POS_Y,s32 POS_Z);
void ANO_DT_Send_SINSSpend(s16 SPEED_X,s16 SPEED_Y,s16 SPEED_Z);
void ANO_DT_Send_SINSDistance(u8 DIRECTION,u16 ANGLE,u32 DIST);
void ANO_DT_Send_RemoteControl(s16 ROL,s16 PIT,s16 THR,s16 YAW,s16 AUX1,s16 AUX2,s16 AUX3,s16 AUX4,s16 AUX5,s16 AUX6);
void ANO_DT_Send_NEWControl(s16 CTRL_ROL,s16 CTRL_PIT,s16 CTRL_THR,s16 CTRL_YAWDPS,s16 CTRL_SPD_X,s16 CTRL_SPD_Y,s16 CTRL_SPD_Z);
void ANO_DT_Send_light_Stream_Mode0(u8 STATE,u8 DX_0,u8 DY_0,u8 QUALITY);
void ANO_DT_Send_light_Stream_Mode1(u8 STATE,s16 DX_1,s16 DY_1,u8 QUALITY);
void ANO_DT_Send_Data(u8 *dataToSend , u8 length);
void ANO_DT_Send_light_Stream_Mode2(u8 STATE,s16 DX_2,s16 DY_2,s16 DX_FIX,s16 DY_FIX,s16 INTEG_X,s16 INTEG_Y,u8 QUALITY);
void ANO_DT_Send_ReadGPS_WayPoint(u8 NUM);
void ANO_DT_Send_ReadBackGPS_WayPoint(u8 NUM,s32 LAT,s32 LGN,s32 ALT,u16 SPD,u16 YAW,u8 FUN,u8 CMD1,u8 cmd2,u8 cmd3,u8 cmd4);
void ANO_DT_Send_FirmwareID(u16 PAR_ID,s32 PAR_VAL);
void ANO_DT_Data_Receive_Anl(u8 *data,u8 len);
#endif

